<?php
/**
 * Extend Zend_Application_Resource_Translate
 * Auto select translate file by locale
 * 
 * @copyright  Copyright (c) 2011 Ricky Feng (http://code.google.com/p/rphp4zf)
 * @license    New BSD License
 */

class Mediad2_Application_Resource_Session extends Zend_Application_Resource_Session
{
    public function init()
    {
   	
    	/**
		* 初始化session，采用数据库保存方式
		*/
    	$options = $this->getOptions();
    	
		$db1 = Zend_Registry::get('db1');
		Zend_Db_Table::setDefaultAdapter($db1);

		//初始化
		parent::init();
		
		//启动
		if (!Zend_Session::isStarted()) {
			Zend_Session::start();
		}
		
		//放入注册表
		$session = new Zend_Session_Namespace('Mediad2');
		Zend_Registry::set('Mediad2', $session);
		
		return $session;

    }
}

